package com.second.app.thread.join.test;

import io.swagger.models.auth.In;

/**
 * @Author GYZ
 * <pre>
 *
 * </pre>
 */
public class JoinDemo {

    public static void main(String[] args) {
        Thread threadA = new Thread(() -> {
            for (int i = 0; i < Integer.MAX_VALUE; i++) {
                String newString = new String();
                Math.random();
            }
        }, "线程A");

        Thread threadB = new Thread(() -> {
            try {
                threadA.start();
                threadA.join(2000);
                System.out.println("线程B执行了。。。");
            } catch (InterruptedException e) {
                e.printStackTrace();
                System.out.println("线程B在catch出执行了。。。");
            }
        }, "线程B");
        threadB.start();

//        new Thread(threadB::interrupt, "线程C").start();
    }
}
